#ifndef __XML_PARSER_PARSE_H__
#define __XML_PARSER_PARSE_H__

#include "typedefs.h"
#include "errordef.h"
#include "xmlstruct.h"
#include "xmlscan.h"
#include "vararryt.h"

typedef CVarArrayT<LPXmlContent> CXmlContentPtrArray;
typedef CVarArrayT<LPXmlAttribute> CXmlAttrPtrArray;

#define INIT_SIZE    10
#define INC_STEP     10

class CXMLParser
{
public:
   CXMLParser (int nBufSize);
   virtual ~CXMLParser ();
   
   int32 OpenFile (char* szFilename);
   void  CloseFile ();
   int32 GetNextInPreorder (LPXmlContent* ppXmlContent);
   int32 GetLine ();
   int32 GetCol ();
   
protected:
   XmlContent*             m_pPI;
   CXmlContentPtrArray     m_arrayContents;
   int32                   m_nPrevTokenType;  
   int32                   m_nCount;
   CXMLScanner             m_scScanner;
   BOOL                    m_bRootFound;
   
   int32 AddContentToArray (LPXmlContent pContent, int nIdx);
   LPXmlContent NewContent (int nType);
   int32 GetAttribute (LPXmlAttribute* ppAttr);
   
   int32 OnCDATAContent ();
   int32 OnElement ();
   int32 OnPI ();
   int32 OnEndTag ();
};

#endif /* __XML_PARSER_PARSE_H__ */ 
